package com.clive.ttwebdemo.controller;

import com.clive.ttwebdemo.bean.Dishes;
import com.clive.ttwebdemo.bean.DishesCategory;
import com.clive.ttwebdemo.service.DishServiceCategory;
import com.clive.ttwebdemo.vo.DishResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/dishCategory")
public class DishCategoryController {
    @Autowired
    private DishServiceCategory dishServiceCategory;
    @RequestMapping("/all")
    public DishResult findDishCategoryAll(){
        List<DishesCategory> List = dishServiceCategory.findDishCategoryAll();
          return DishResult.ok().date("categoryList",List);
    }
    @RequestMapping("/delete/{id}")
    public DishResult deleteDishesCategory(@PathVariable Integer id){
        int count = dishServiceCategory.deleteDishesCategory(id);
        return DishResult.ok().date("count",count);
    }
}
